package com.softeem.dao.impl;

import com.softeem.bean.Order;
import com.softeem.dao.OrderDao;
import com.softeem.utils.BaseDao;

import java.sql.SQLException;
import java.util.Random;

public class OrderDaoImpl extends BaseDao<Order> implements OrderDao {
    @Override
    public String saveOrder(Double price, Integer uid) throws SQLException {
        Random r = new Random();
        String orderId = "" + System.currentTimeMillis() + (int)(Math.random() * 1000) + uid;
        super.update("insert into t_order values(?,now(),?,?,?)",orderId,price,0,uid);
        return orderId;
    }
}
